package com.dhcc.core.api.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * API接口文档
 *
 * @author dhcc
 * @date 2017-03-23 15:47
 */
@Controller
@RequestMapping("${sys.backendPath}/api")
public class ApiDocController {

	@Value("${sys.backendPath}")
	private String backendPath;

	@Value("${springfox.documentation.swagger.v2.host:DEFAULT}")
	private String hostNameOverride;
	
	public static final String DEFAULT_URL = "/v2/api-docs";
	@Value("${springfox.documentation.swagger.v2.path:" + DEFAULT_URL + "}")
	private String apiUrlOverride;

	/**
	 * 跳转到API接口文档首页-code
	 */
	@RequestMapping("/doc")
	public String index(Model model) {
		model.addAttribute("apiDocUrl", apiUrlOverride);
		return "/doc.html";
	}
}
